(*# call(o_a_copy => off) *)
(*%F _fdata *)
(*# call(seg_name => null) *)
(*%E *)
(*# module(implementation=>on) *)
(*# data(seg_name => null) *)
DEFINITION MODULE QCdisp;

                     (* This JPI Modula-2 module is part of *)

                      (* QC -- a communications program *)
                             (* by Carl Neiburger *)
                              (* 169 N. 25th St.*)
                          (* San Jose, Calif. 95116 *)

                         (* CompuServe No. 72336,2257 *)

(* DataDisplay produces a screen looking like this:

2 Date        Sending/Receiving (ASCII/Binary) Modem speed: 0000 bps       Time
3 D:\PATH\Filename
4 Protoco-CRC                 Data rate: 00000 Bytes         Time left: 000:00
5
6            Packets    Total Bytes    Data Bytes    Data Left    Errors
7 Sent
8 Received
  0        1         2         3         4         5         6         7
  1        0         0         0         0         0         0         0
*)
IMPORT NFIO;
FROM UTIL IMPORT str4, str9, str10, str80;
FROM CharMask IMPORT MaskProc;

TYPE

    DataField = ( Packets, TotalBytes, DataBytes, Errs, DataLeft );
    ProtoType = (XModem, XModem1K, YModem, Telink, Kermit, BPlus, ZModem );
    MaskType = ( SevenBit, EightBit, IbmXlate );
    BaudNameArray = ARRAY[0..6] OF str4;
    ProtoNameArray =ARRAY ProtoType OF str9;

    QCDefType = RECORD
        baud        : [SHORTCARD(0)..SHORTCARD(6)];
        LAPrinter   : BOOLEAN;
        Protocol    : ProtoType;
        Mask        : MaskType;
        EditBS      : BOOLEAN;
        DestBS      : BOOLEAN;
        EditEscs    : BOOLEAN;
        DecTerm     : BOOLEAN;
        UseDel      : BOOLEAN;
        DelayOn     : [0..2];
        DLpath,
        QCpath      : NFIO.PathStr;
    END;

    QCDefTypePtr = POINTER TO QCDefType;

    DataRegisterType = ARRAY BOOLEAN, DataField OF LONGCARD;

CONST
(*#save *)
(*# data(const_assign => on) *)
QCDef = QCDefType(
    3,        (* baud *)
    FALSE,    (* LAPrinter *)
    XModem,   (* Protocol *)
    SevenBit, (* Mask7 *)
    TRUE,     (* EditBS *)
    TRUE,     (* Destructive BS on *)
    TRUE,     (* EditEscs *)
    FALSE,    (* No DEC Term *)
    FALSE,    (* Use BS, not DEL *)
    0,        (* No delay *)
    0C,       (* No DLpath *)
    0C);      (* No QCpath *)
(*#restore *)

baudnames = BaudNameArray (' 300', ' 600', '1200', '2400', '4800', 
                           '9600', '19.2');

ProtoNames =
     ProtoNameArray('XModem   ', 'XModem-1K', 'YModem   ', 'Telink   ',
                    'Kermit   ', 'B Plus   ', 'ZModem   ' );

    AbortMsg = 'Aborting at your request.';
    TimeoutMsg = 'Time out.';
    TimeoutAbortMsg = 'Timed out. Aborting.';
    CreateError = 'Error creating file.';
    WriteErrorMsg = 'Write error. Aborting.';
    CloseError = 'Error closing file.';
    OpenError = 'Cannot open file.';
    PressExit = ' Press Exit to quit. ';
    PressAny  = 'Press any key.';

CONST
    PhoneFileTail = 'Phones.QC';
    MacroFileTail = 'MACROS.QC';

VAR
    QCDefPtr : QCDefTypePtr;

    PhoneFileName,
    MacroFileName : NFIO.PathStr;

    ConfMode,
    sawDLE,
    Printing    : BOOLEAN;

    MaskChar : MaskProc;

    DataRegisters : DataRegisterType;

(*#save *)
(*#call(near_call=>on) *)
PROCEDURE SetMask;

PROCEDURE GrafOff;

PROCEDURE CloseLog;

PROCEDURE ResetLogEscState;

PROCEDURE DoOpenLog( name : NFIO.PathStr ): SHORTCARD;

PROCEDURE OpenLog;

PROCEDURE TogglePrinting;

PROCEDURE WriteDisplay(ch: CHAR);

PROCEDURE ToggleDecTerm;

PROCEDURE EnableConfMode;

PROCEDURE DisableConfMode;

PROCEDURE ToggleConfMode;

PROCEDURE ShowCurrentDate;

PROCEDURE ShowCurrentTime;

PROCEDURE PromptForChar( prompt : ARRAY OF CHAR; VAR ch:CHAR );
(*#restore *)

PROCEDURE FlushLog;

PROCEDURE PressKey( message: ARRAY OF CHAR );

PROCEDURE ShowTransferTime;

PROCEDURE ShowErrorType(ItsCRC: BOOLEAN);

PROCEDURE UpdateData;

PROCEDURE StartDisplay( UseProto: BOOLEAN; Proto : ProtoType;
                      Receiving : BOOLEAN );

PROCEDURE ShowTransferType( FileType: ARRAY OF CHAR );

PROCEDURE ShowTimeLeft( Receiving: BOOLEAN);

PROCEDURE DisplayData( field: DataField; Receiving: BOOLEAN);

PROCEDURE IncrDataBytes( Num: CARDINAL; Receiving: BOOLEAN );

PROCEDURE ShowFileName( Name : ARRAY OF CHAR; Receiving: BOOLEAN );

PROCEDURE ShowPacketSize( i : CARDINAL );

PROCEDURE StatusMessage( Msg : ARRAY OF CHAR; WaitForKey : BOOLEAN );

PROCEDURE StopDisplay;

PROCEDURE Yes ( prompt : ARRAY OF CHAR ): BOOLEAN;

PROCEDURE PromptForString(
    prompt : ARRAY OF CHAR; VAR s : ARRAY OF CHAR ): BOOLEAN;
(* Returns TRUE if s <> '' *)

END QCdisp.